Magnetic sensor and magnetic sensor system

ABSTRACT

At a reference position within a first plane, a magnetic field to be detected has a first direction that changes within the first plane. A magnetic sensor includes an MR element. The MR element includes a magnetic layer having first magnetization that can change in direction within a second plane. The first plane and the second plane intersect at a dihedral angle α other than 90°. The magnetic field to be detected can be divided into an in-plane component parallel to the second plane and a perpendicular component perpendicular to the second plane. The in-plane component has a second direction that changes with a change in the first direction. The direction of the first magnetization changes with a change in the second direction. A detection value depends on the direction of the first magnetization.

CROSS REFERENCE TO RELATED APPLICATION

This application is a continuation of U.S. application Ser. No.17/836,016, filed Jun. 9, 2022, which is a continuation of U.S.application Ser. No. 16/878,008, filed May 19, 2020, the contents ofwhich are incorporated herein by reference.

BACKGROUND OF THE INVENTION 1. Field of the Invention

The present invention relates to a magnetic sensor, and a magneticsensor system including the magnetic sensor.

2. Description of the Related Art

Magnetic sensors have been used for a variety of applications. Examplesof known magnetic sensors include one that uses a spin-valvemagnetoresistive element provided on a substrate. The spin-valvemagnetoresistive element includes a magnetization pinned layer having amagnetization whose direction is fixed, a free layer having amagnetization whose direction is variable depending on the direction ofan applied magnetic field, and a gap layer located between themagnetization pinned layer and the free layer. In many cases, thespin-valve magnetoresistive element provided on a substrate isconfigured to have sensitivity to a magnetic field in a directionparallel to the surface of the substrate. Such a magnetoresistiveelement is thus suitable to detect a magnetic field that changes indirection within a plane parallel to the substrate surface.

On the other hand, a system including a magnetic sensor may be intendedto detect a magnetic field containing a component in a directionperpendicular to the surface of a substrate by using a magnetoresistiveelement provided on the substrate. An example of such a system isdescribed in US 2015/0192432 A1, JP H09-219546 A, US 2008/0169807 A1,and US 2018/0275218 A1.

US 2015/0192432 A1 describes a magnetic sensor for detecting theposition of a magnet. This magnetic sensor includes a substrate, twomagnetic sensor elements located on the substrate, a magnet locatedabove the substrate, and a soft magnetic body. The soft magnetic body islocated between the magnet and the two magnetic sensor elements. Thesoft magnetic body converts a magnetic field on an XZ plane, generatedby the magnet, into a magnetic field on an XY plane to which the twomagnetic sensor elements have sensitivity. The XY plane is parallel tothe substrate surface. The XZ plane is perpendicular to the substratesurface.

JP H09-219546 A describes an apparatus in which a magnetoresistiveelement including magnetic stripes is located on a slope formed on asubstrate, and a rotating body including a magnet is located above thesubstrate. In this apparatus, as the rotating body rotates, thedirection of a magnetic field generated by the rotating body changeswithin a plane of variation perpendicular to the slope. Themagnetoresistive element detects the magnetic field generated by therotating body.

US 2008/0169807 A1 and US 2018/0275218 A1 describe an apparatusincluding three sensors for detecting an X-direction component, aY-direction component, and a Z-direction component of an externalmagnetic field. In this apparatus, the sensor for detecting theZ-direction component includes a magnetoresistive element located on aslope formed on a substrate.

The magnetic sensor described in US 2015/0192432 A1 has a problem thatthe detection accuracy can drop due to an unnecessary magnetic fieldoccurring from the soft magnetic body and the magnetic hysteresischaracteristics of the soft magnetic body.

Next, a problem with the apparatuses described in JP H09-219546 A, US2008/0169807 A1, and US 2018/0275218 A1 will be described. The sensorfor detecting the Z-direction component in US 2008/0169807 A1 and US2018/0275218 A1 will hereinafter be referred to as a Z-direction sensor.The magnetic field applied to the magnetoresistive element in JPH09-219546 A and the magnetic field applied to the Z-direction sensor inUS 2008/0169807 A1 and US 2018/0275218 A1 will each be referred to as anapplied magnetic field. The component of the applied magnetic field towhich the magnetoresistive element according to JP H09-219546 A hassensitivity and the component of the applied magnetic field to which theZ-direction sensor according to US 2008/0169807 A1 and US 2018/0275218A1 has sensitivity will each be referred to as a sensitivity component.

The strength of the applied magnetic field can vary due to reasons suchas variations in the arrangement of the constituent parts of theapparatus. The apparatuses described in JP H09-219546 A, US 2008/0169807A1, and US 2018/0275218 A1 have a problem that the detection accuracydrops greatly relative to variations in the strength of the appliedmagnetic field. A detailed description thereof is given below.

The lower the strength of the sensitivity component, the greater thedegree of drop in the detection accuracy relative to variations in thestrength of the applied magnetic field. In the apparatus described in JPH09-219546 A, the direction of the applied magnetic field changes withinthe plane of variation of the magnetic field perpendicular to the slope.In the apparatus, the direction of the applied magnetic field can thusbe perpendicular to the slope, i.e., direction to which themagnetoresistive element has no sensitivity. In such an apparatus, thestrength of the sensitivity component can be zero.

In the apparatuses described in US 2008/0169807 A1 and US 2018/0275218A1, the direction of the applied magnetic field can be perpendicular tothe slope, i.e., direction to which the Z-direction sensor has nosensitivity. In such an apparatus, the strength of the sensitivitycomponent can be zero.

In the apparatuses described in JP H09-219546 A, US 2008/0169807 A1, andUS 2018/0275218 A1, the detection accuracy can drop greatly relative tovariations in the strength of the applied magnetic field if thedirection of the applied magnetic field is such that the strength of thesensitivity component has a value of zero or near zero in particular.

SUMMARY OF THE INVENTION

An object of the present invention is to provide a magnetic sensor thatcan generate a detection value corresponding to the direction of amagnetic field to be detected that changes in direction within avariable range including a direction outside a predetermined plane byusing a magnetoresistive element suitable to detect a magnetic fieldthat changes in direction within the predetermined plane whilesuppressing a drop in detection accuracy, and a magnetic sensor systemincluding the magnetic sensor.

A magnetic sensor according to the present invention detects a magneticfield to be detected and generates a detection value. The magnetic fieldto be detected has a first direction at a reference position within afirst plane, and the first direction changes within a predeterminedvariable range in the first plane. The magnetic sensor according to thepresent invention includes at least one magnetoresistive element. The atleast one magnetoresistive element each includes a first magnetic layerhaving first magnetization that can change in direction within acorresponding second plane. The first plane and the second planeintersect at a dihedral angle other than 90°.

The magnetic field to be detected received by each of the at least onemagnetoresistive element can be divided into an in-plane componentparallel to the second plane and a perpendicular component perpendicularto the second plane. The in-plane component has a second direction thatchanges with a change in the first direction. The direction of the firstmagnetization changes with a change in the second direction. Thedetection value depends on the direction of the first magnetization.

In the magnetic sensor according to the present invention, the firstmagnetic layer may have a characteristic that the first magnetization issaturated by the magnetic field to be detected if the first direction isin at least part of the variable range.

In the magnetic sensor according to the present invention, the at leastone magnetoresistive element may each further include a second magneticlayer having second magnetization in a direction parallel to the secondplane, and a gap layer located between the first magnetic layer and thesecond magnetic layer.

In the magnetic sensor according to the present invention, the dihedralangle may be in a range of 30° to 84°.

The magnetic sensor according to the present invention may include afirst magnetoresistive element and a second magnetoresistive element asthe at least one magnetoresistive element. In this case, the magneticsensor may further include a signal output node. The first and secondmagnetoresistive elements may be connected in series via the signaloutput node. The detection value may depend on a potential of the signaloutput node.

The magnetic sensor according to the present invention may furtherinclude a substrate that supports the at least one magnetoresistiveelement. The substrate may include a main surface perpendicular to thefirst plane and at least one slope oblique to the main surface. The atleast one magnetoresistive element may be located on the at least oneslope. The second plane corresponding to each of the at least onemagnetoresistive element may be parallel to the slope on which each ofthe at least one magnetoresistive element is located. It will beunderstood that the slope here is a flat surface (plane). In the presentinvention, that two planes are parallel, like the second plane and theslope are parallel, covers a situation where the two planes overlap.

If the magnetic sensor according to the present invention includes thesubstrate, the magnetic sensor may include a first magnetoresistiveelement and a second magnetoresistive element as the at least onemagnetoresistive element. The substrate may include, as the at least oneslope, a first slope on which the first magnetoresistive element islocated and a second slope on which the second magnetoresistive elementis located. The second plane corresponding to the first magnetoresistiveelement may be parallel to the first slope. The second planecorresponding to the second magnetoresistive element may be parallel tothe second slope.

If the magnetic sensor according to the present invention includes thesubstrate and the first and second magnetoresistive elements, themagnetic sensor may further include a signal output node. The first andsecond magnetoresistive elements may be connected in series via thesignal output node. The detection value may depend on a potential of thesignal output node.

If the magnetic sensor according to the present invention includes thesubstrate and the first and second magnetoresistive elements, the firstand second magnetoresistive elements may be connected in series. Thedetection value may depend on a combined resistance of the first andsecond magnetoresistive elements.

The magnetic sensor according to the present invention may furtherinclude a first magnetic detection unit that includes the at least onemagnetoresistive element and generates a first detection signaldependent on the direction of the first magnetization, a second magneticdetection unit that detects the magnetic field to be detected andgenerates a second detection signal dependent on the first direction,and a detection value generation unit that generates the detection valueon the basis of the first detection signal and the second detectionsignal. The variable range may include a first region and a secondregion that are different from each other. In this case, two candidatesfor the first direction corresponding to a specific same value of thefirst detection signal may fall within the respective first and secondregions. Two values of the second detection signal corresponding to thetwo candidates may be different from each other.

A magnetic sensor system according to the present invention includes themagnetic sensor according to the present invention and a magnetic fieldgenerator that generates the magnetic field to be detected. The magneticsensor and the magnetic field generator may be configured such that thefirst direction changes as a relative position of the magnetic fieldgenerator with respect to the magnetic sensor changes. In this case, therelative position of the magnetic field generator with respect to themagnetic sensor may be rotatable about the magnetic sensor.

In the magnetic sensor and the magnetic sensor system according to thepresent invention, the first plane and the second plane intersect at adihedral angle other than 90°. This prevents the strength of thein-plane component from becoming zero regardless of the first directionwithin the variable range as long as there is a magnetic field to bedetected. For this reason, according to the present invention, thedetection value corresponding to the direction of the magnetic field tobe detected that changes in direction within a variable range includinga direction outside a predetermined plane can be generated by using amagnetoresistive element or elements suitable to detect a magnetic fieldthat changes in direction within the predetermined plane whilesuppressing a drop in detection accuracy.

Other and further objects, features and advantages of the presentinvention will appear more fully from the following description.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a perspective view showing a schematic configuration of amagnetic sensor system according to a first embodiment of the invention.

FIG. 2 is a front view showing a schematic configuration of a magneticsensor system according to the first embodiment of the invention.

FIG. 3 is an explanatory diagram for describing a magnetic field to bedetected of the first embodiment of the invention.

FIG. 4 is an explanatory diagram showing an in-plane component and aperpendicular component of the magnetic field to be detected of thefirst embodiment of the invention.

FIG. 5 is a perspective view showing a magnetic sensor according to thefirst embodiment of the invention.

FIG. 6 is a circuit diagram showing a configuration of the magneticsensor according to the first embodiment of the invention.

FIG. 7 is a perspective view showing a part of a magnetoresistiveelement of the first embodiment of the invention.

FIG. 8 is an explanatory diagram showing a definition of a first angleof the first embodiment of the invention.

FIG. 9 is an explanatory diagram showing a definition of a second angleof the first embodiment of the invention.

FIG. 10 is a waveform chart showing a change in a component of each offirst and second vectors with respect to a change in the first angle ofthe first embodiment of the invention.

FIG. 11 is an explanatory diagram showing a configuration of a throttleto which the magnetic sensor system according to the first embodiment ofthe invention can be applied.

FIG. 12 is an explanatory diagram showing a schematic configuration of amagnetic sensor system according to a second embodiment of theinvention.

FIG. 13 is a perspective view showing a magnetic sensor according to thesecond embodiment of the invention.

FIG. 14 is a circuit diagram showing a configuration of the magneticsensor according to the second embodiment of the invention.

FIG. 15 is a waveform chart showing a relationship between a secondangle and a first detection signal in the second embodiment of theinvention.

FIG. 16 is a waveform chart showing a relationship between a first angleand a second detection signal in the second embodiment of the invention.

FIG. 17 is a perspective view showing a magnetic sensor according to athird embodiment of the invention.

FIG. 18 is a perspective view showing at least part of a magnetic sensoraccording to a fourth embodiment of the invention.

FIG. 19 is a circuit diagram showing a configuration of a first magneticdetection unit of the magnetic sensor according to the fourth embodimentof the invention.

FIG. 20 is a perspective view showing a magnetic sensor according to afifth embodiment of the invention.

FIG. 21 is a sectional view showing a cross section of the magneticsensor according to the fifth embodiment of the invention.

FIG. 22 is a circuit diagram showing a configuration of a first magneticdetection unit of a magnetic sensor according to a sixth embodiment ofthe invention.

FIG. 23 is a perspective view showing a magnetic sensor according to aseventh embodiment of the invention.

FIG. 24 is a sectional view showing a cross section of the magneticsensor according to the seventh embodiment of the invention.

FIG. 25 is a sectional view showing another cross section of themagnetic sensor according to the seventh embodiment of the invention.

FIG. 26 is a block diagram showing a configuration of the magneticsensor according to the seventh embodiment of the invention.

FIG. 27 is a circuit diagram showing a configuration of a first magneticdetection unit of the magnetic sensor according to the seventhembodiment of the invention.

FIG. 28 is a circuit diagram showing a configuration of a secondmagnetic detection unit of the magnetic sensor according to the seventhembodiment of the invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS First Embodiment

Preferred embodiments of the present invention will now be described indetail with reference to the drawings. Initially, a magnetic sensorsystem according to a first embodiment of the invention will be outlinedwith reference to FIGS. 1 and 2 . A magnetic sensor system 1 accordingto the present embodiment includes a magnetic sensor 2 according to thepresent embodiment and a magnetic field generator 5 that generates amagnetic field to be detected.

The magnetic field generator 5 has a ring shape with a rotation axis Cat the center, and is rotatable about the rotation axis C. Consideringthe magnetic field generator 5 as a ring, the magnetic sensor 2 islocated in a portion corresponding to the hole of the ring. The magneticsensor 2 is located on the rotation axis C. In FIG. 1 , the magneticsensor 2 and the magnetic field generator 5 are shown to be separatedfrom each other along the rotation axis C. The magnetic sensor 2 detectsthe magnetic field to be detected generated by the magnetic fieldgenerator 5, and generates a detection value θs. The detection value θscorresponds to a relative position, or rotational position inparticular, of the magnetic field generator 5 with respect to themagnetic sensor 2.

The magnetic field generator 5 includes two magnets 6A and 6B and twoyokes 7A and 7B. The magnets 6A and 6B are arranged at symmetricalpositions with a virtual plane including the rotation axis C at thecenter. The magnets 6A and 6B each have an N pole and an S pole atrespective ends in the direction of rotation of the magnetic fieldgenerator 5. The yoke 7A connects the N pole of the magnet 6A and the Npole of the magnet 6B. The yoke 7B connects the S pole of the magnet 6Aand the S pole of the magnet 6B.

Now, we define X, Y, and Z directions as shown in FIGS. 1 and 2 . The X,Y, and Z directions are orthogonal to one another. In the presentembodiment, a direction parallel to the rotation axis C (in FIG. 1 ,rightward direction) will be referred to as the X direction. In FIG. 2 ,the Y direction is shown as a leftward direction. In FIGS. 1 and 2 , theZ direction is shown as an upward direction. The opposite directions tothe X, Y, and Z directions will be referred to as −X, −Y, and −Zdirections, respectively.

Next, the magnetic field to be detected generated by the magnetic fieldgenerator 5 will be described with reference to FIGS. 1 to 4 . FIG. 3 isan explanatory diagram for describing the magnetic field to be detected.FIG. 4 is an explanatory diagram showing an in-plane component and aperpendicular component of the magnetic field to be detected.

In the present embodiment, both a magnetic flux occurring from the Npole of the magnet 6A and a magnetic flux occurring from the N pole ofthe magnet 6B flow out of the yoke 7A into the yoke 7B. This generates amagnetic field to be detected MF directed from the yoke 7A to the yoke7B.

In FIGS. 3 and 4 , a plane denoted by the symbol PL1 represents a YZplane intersecting the magnetic sensor 2 and the magnetic fieldgenerator 5. This plane will hereinafter be referred to as a first planePL1. The magnetic field to be detected MF has a first direction D1 at areference position P0 within the first plane PL1. The reference positionP0 is located inside or at the surface of the magnetic sensor 2. Thefirst direction D1 changes within a predetermined variable range in thefirst plane PL1. In FIG. 3 , the arrow denoted by the symbol D1represents the first direction D1 and the strength of the magnetic fieldto be detected MF at the reference position P0. The end of the arrowdenoted by the symbol D1 moves along a circle denoted by the symbol C1.In the present embodiment, the variable range of the first direction D1is 180° or less in size.

The magnetic sensor 2 and the magnetic field generator 5 are configuredsuch that the first direction D1 changes as the relative position of themagnetic field generator 5 with respect to the magnetic sensor 2changes. More specifically, as the magnetic field generator 5 rotatesabout the rotation axis C, the relative position of the magnetic fieldgenerator 5 with respect to the magnetic sensor 2 rotates about themagnetic sensor 2. The first direction D1 thus rotates about thereference position P0.

In FIGS. 3 and 4 , a plane denoted by the symbol PL3 represents an XYplane passing the reference position P0. This plane will hereinafter bereferred to as a reference plane PL3.

In the present embodiment, a second plane related to the magnetic sensor2 is defined. The second plane is oblique to both the first plane PL1and the reference plane PL3. The first plane PL1 and the second planeintersect at a dihedral angle α other than 90°. The dihedral angle α isgreater than 0° and smaller than 90°. The second plane of the presentembodiment is a plane obtained by rotating the XY plane about an axis inthe Y direction by an angle of 90°-α. A plane PL2 shown in FIGS. 3 and 4is an example of the second plane. The plane PL2 shown in FIGS. 3 and 4passes the reference position P0. However, the second plane does notnecessarily pass the reference position P0.

A direction rotated from the Z direction toward the −X direction by awill be referred to as a U direction. The direction opposite to the Udirection will be referred to as a −U direction. The plane PL2 is aplane parallel to the U direction and the Y direction, i.e., a UY plane.

As shown in FIG. 4 , the magnetic field to be detected MF at thereference position P0 can be divided into an in-plane component MFaparallel to the plane PL2 and a perpendicular component MFbperpendicular to the plane PL2. FIG. 4 shows a state where the firstdirection D1 that is the direction of the magnetic field to be detectedMF at the reference position P0 coincides with the Z direction. Thein-plane component MFa has a second direction D2 that changes with achange in the first direction D1. In FIG. 3 , the arrow denoted by thesymbol D2 represents the second direction D2 and the strength of thein-plane component MFa. The end of the arrow denoted by the symbol D2moves along an ellipse denoted by the symbol C2.

FIG. 3 shows a virtual line L1, a virtual line L2, and intersections P1,P2, P3, and P4. The virtual line L1 passes the reference position P0 andis parallel to the Z direction. The virtual line L2 passes the referenceposition P0 and is parallel to the U direction. The intersections P1 andP2 are those of the virtual line L1 and the circle C1. The intersectionsP3 and P4 are those of the virtual line L2 and the ellipse C2. Thevirtual line L2, the ellipse C2, the intersections P3 and P4, and thesecond direction D2 are orthogonal projections of the virtual line L1,the circle C1, the intersections P1 and P2, and the first direction D1upon the plane PL2, respectively.

The magnetic sensor 2 includes at least one magnetoresistive element(hereinafter, referred to as an MR element). In the present embodiment,a second plane is defined for each of the at least one MR element. Inthe present embodiment, each second plane intersects its correspondingMR element.

The at least one MR element each includes a first magnetic layer havingfirst magnetization that can change in direction within thecorresponding second plane. Like the magnetic field to be detected MF atthe reference position P0, the magnetic field to be detected MF receivedby each of the at least one MR element can be divided into an in-planecomponent parallel to the second plane and a perpendicular componentperpendicular to the second plane. Like the in-plane component MFa shownin FIG. 4 , the in-plane component has a second direction that changeswith a change in the first direction D1. The direction of the firstmagnetization in each of the at least one MR element changes with achange in the second direction. The detection value θs depends on thedirection of the first magnetization.

Since the second direction changes with a change in the first directionD1, the direction of the first magnetization changes with a change inthe first direction D1. The detection value θs thus corresponds to thefirst direction D1.

If the magnetic sensor 2 includes a plurality of MR elements, theplurality of MR elements are located within an area where no substantialdifference occurs in the direction of the magnetic field to be detectedMF depending on the positions where the plurality of MR elements receivethe magnetic field to be detected MF. The directions of the magneticfield to be detected MF received by the plurality of MR elements arethus substantially the same.

Next, a configuration of the magnetic sensor 2 will be described withreference to FIGS. 5 and 6 . FIG. 5 is a perspective view showing themagnetic sensor 2. FIG. 6 is a circuit diagram showing the configurationof the magnetic sensor 2. As shown in FIG. 6 , in the presentembodiment, the magnetic sensor 2 includes a first magnetic detectionunit 10 that includes at least one MR element and generates a firstdetection signal S1 dependent on the direction of first magnetization.In the present embodiment, the first magnetic detection unit 10 includesan MR element 11.

As shown in FIG. 5 , the magnetic sensor 2 further includes a substrate3 that supports the MR element 11. The substrate 3 includes a mainsurface 3 a perpendicular to the first plane PL1 (YZ plane) shown inFIGS. 3 and 4 . In particular, in the present embodiment, the mainsurface 3 a is parallel to the reference plane PL3 (XY plane) shown inFIGS. 3 and 4 .

The substrate 3 further includes a groove portion 3 c open in the mainsurface 3 a. The groove portion 3 c includes a slope 3 b oblique to themain surface 3 a. The slope 3 b is a flat surface. The MR element 11 islocated on the slope 3 b. The second plane corresponding to the MRelement 11 is parallel to the slope 3 b.

In the present embodiment, the position where the MR element 11 islocated is the reference position P0. The plane PL2 shown in FIGS. 3 and4 is the second plane corresponding to the MR element 11. For the sakeof convenience, in the present embodiment, the second planecorresponding to the MR element 11 will be referred to as a second planePL2. Like the second plane PL2, the slope 3 b is tilted to form thedihedral angle α with respect to the first plane PL1 and is parallel tothe UY plane.

In the present embodiment, the in-plane component MFa shown in FIG. 4 isthe in-plane component of the magnetic field to be detected MF receivedby the MR element 11. The second direction D2 shown in FIG. 3 is thesecond direction of the in-plane component of the magnetic field to bedetected MF received by the MR element 11. For the sake of convenience,in the present embodiment, the in-plane component of the magnetic fieldto be detected MF received by the MR element 11 will be referred to asan in-plane component MF2 a. The second direction of the in-planecomponent of the magnetic field to be detected MF received by the MRelement 11 will be referred to as a second direction D2.

As shown in FIG. 6 , the first magnetic detection unit 10 furtherincludes a resistor 12, a signal output node E1, a power supply node V1,and a ground node G1. Since the first magnetic detection unit 10 is partof the magnetic sensor 2, the magnetic sensor 2 can be said to includethe resistor 12, the signal output node E1, the power supply node V1,and the ground node G1. The MR element 11 and the resistor 12 areconnected in series via the signal output node E1. The resistor 12 isarranged between the power supply node V1 and the signal output node E1.The MR element 11 is arranged between the signal output node E1 and theground node G1. A predetermined magnitude of power supply voltage isapplied to the power supply node V1. The ground node G1 is grounded.

The MR element 11 may be a spin valve MR element or an anisotropic MRelement. In particular, in the present embodiment, the MR element 11 isa spin valve MR element. In this case, the MR element 11 includes asecond magnetic layer and a gap layer aside from the foregoing firstmagnetic layer. The second magnetic layer has second magnetization in adirection parallel to the second plane PL2. The gap layer is locatedbetween the first and second magnetic layers. The direction of thesecond magnetization does not change with a change in the seconddirection D2 of the in-plane component MFa. The spin-valve MR elementmay be a tunneling magnetoresistive (TMR) element or a giantmagnetoresistive (GMR) element. In the TMR element, the gap layer is atunnel barrier layer. In the GMR element, the gap layer is a nonmagneticconductive layer. The resistance of the MR element 11 changes with anangle that the direction of the first magnetization of the firstmagnetic layer forms with the direction of the second magnetization ofthe second magnetic layer. The resistance is minimized if the angle is0°. The resistance is maximized if the angle is 180°. In FIGS. 5 and 6 ,the thick arrow indicates the direction of the second magnetization. Inthe present embodiment, the direction of the second magnetization is the−U direction.

As described above, the direction of the first magnetization changeswith a change in the second direction D2 of the in-plane component MFa.The second direction D2 changes with a change in the first direction D1of the magnetic field to be detected MF. The resistance of the MRelement 11 thus changes with a change in the first direction D1, and asa result, the signal output node E1 changes in potential. The firstmagnetic detection unit 10 generates a signal corresponding to thepotential of the signal output node E1 as the first detection signal S1.The first detection signal S1 changes with a change in the firstdirection D1.

From the viewpoint of the manufacturing accuracy of the MR element 11,the direction of the second magnetization may be slightly different fromthe foregoing direction.

An example of the configuration of the MR element 11 will now bedescribed with reference to FIG. 7 . FIG. 7 is a perspective viewshowing a part of the MR element 11. In this example, the MR element 11includes a plurality of lower electrodes 41, a plurality of MR films 50,and a plurality of upper electrodes 42. The plurality of lowerelectrodes 41 are located on the slope 3 b of the substrate 3. Each ofthe lower electrodes 41 has a long slender shape. Every two lowerelectrodes 41 adjacent to each other in the longitudinal direction ofthe lower electrodes 41 have a gap therebetween. As shown in FIG. 7 , MRfilms 50 are provided on the top surfaces of the lower electrodes 41,near opposite ends in the longitudinal direction. Each of the MR films50 includes a first magnetic layer 51, a gap layer 52, a second magneticlayer 53, and an antiferromagnetic layer 54 which are stacked in thisorder, the first magnetic layer 51 being closest to the lower electrode41. The first magnetic layer 51 is electrically connected to the lowerelectrode 41. The antiferromagnetic layer 54 is formed of anantiferromagnetic material. The antiferromagnetic layer 54 is inexchange coupling with the second magnetic layer 53 so as to pin themagnetization direction of the second magnetic layer 53. The pluralityof upper electrodes 42 are arranged over the plurality of MR films 50.Each of the upper electrodes 42 has a long slender shape, andestablishes electrical connection between the respectiveantiferromagnetic layers 54 of two adjacent MR films 50 that arearranged on two lower electrodes 41 adjacent in the longitudinaldirection of the lower electrodes 41. With such a configuration, theplurality of MR films 50 in the MR element 11 shown in FIG. 7 areconnected in series by the plurality of lower electrodes 41 and theplurality of upper electrodes 42. It should be appreciated that thelayers 51 to 54 of the MR films 50 may be stacked in an order reverse tothat shown in FIG. 7 .

As shown in FIG. 6 , the magnetic sensor 2 further includes a detectionvalue generation unit 30 that generates the detection value θs on thebasis of the first detection signal S1. The detection value θs dependson the first detection signal S1. Since the first detection signal S1changes with a change in the first direction D1, the detection value θscorresponds to the first direction D1. The detection value generationunit 30 includes an application specific integrated circuit (ASIC) or amicrocomputer, for example.

Next, a method for generating the detection value θs will be described.Here, the angle that the first direction D1 of the magnetic field to bedetected MF forms with respect to a predetermined reference directionwill be referred to as a first angle and denoted by the symbol θ1. Theangle that the second direction D2 of the in-plane component MFa formswith respect to a predetermined reference direction will be referred toas a second angle and denoted by the symbol θ2. The second angle θ2 hasa correlation with the first angle θ1.

FIG. 8 is an explanatory diagram showing the definition of the firstangle θ1. FIG. 8 shows the first plane PL1, the reference position P0,the first direction D1, and the circle C1 shown in FIG. 3 . In the firstplane PL1, the first direction D1 rotates about the reference positionP0. In the present embodiment, the Z direction serves as the referencedirection for representing the first angle θ1. The first angle θ1 isexpressed in positive values when seen clockwise from the Z direction inFIG. 8 . The first angle θ1 is expressed in negative values when seencounterclockwise from the Z direction in FIG. 8 .

As described above, in the present embodiment, the variable range of thefirst direction D1 is 180° or less in size. In the followingdescription, the first angle θ1 shall change within the range of 0° ormore and not more than 180°.

FIG. 9 is an explanatory diagram showing the definition of the secondangle θ2. FIG. 9 shows the plane PL2, i.e., the second plane PL2, thereference position P0, the second direction D2, and the ellipse C2 shownin FIG. 3 . In the second plane PL2, the second direction D2 rotatesabout the position where the MR element 11 is located, i.e., thereference position P0. In the present embodiment, the U direction servesas the reference direction for representing the second angle θ2. Thesecond angle θ2 is expressed in positive values when seen clockwise fromthe U direction in FIG. 9 . The second angle θ2 is expressed in negativevalues when seen counterclockwise from the U direction in FIG. 9 . Inthe present embodiment, the second angle θ2 changes within the range of0° or more and not more than 180°.

The detection value generation unit 30 generates a value having acorrelation with the first angle θ1 as the detection value θs. In thepresent embodiment, the detection value generation unit 30 generates avalue representing the first angle θ1 itself as the detection value θs.Instead of the value representing the first angle θ1 itself, thedetection value generation unit 30 may generate a value having acorrelation with an angle representing the relative position of themagnetic field generator 5 with respect to the magnetic sensor 2 as thedetection value θs. The angle representing the relative position of themagnetic field generator 5 with respect to the magnetic sensor 2 has acorrelation with the first angle θ1.

A method for generating the detection value θs will be specificallydescribed below. Initially, the method for generating the detectionvalue θs will be outlined. The arrow indicating the first direction D1shown in FIG. 8 can be said to represent a vector representing thedirection and strength of the magnetic field to be detected MF receivedby the MR element 11 in the YZ coordinate system with the referenceposition P0 as the origin. This vector will hereinafter be referred toas a first vector. The Y component and the Z component of the firstvector will be denoted by Y1 and Z1, respectively.

The arrow indicating the second direction D2 shown in FIG. 9 can be saidto represent a vector representing the direction and strength of thein-plane component MFa received by the MR element 11 in the YUcoordinate system with the reference position P0 as the origin. Thisvector will hereinafter be referred to as a second vector. The secondvector is an orthogonal projection of the first vector on the secondplane PL2. The Y component of the second vector has the same value asthat of the Y component of the first vector, i.e., Y1. The Y and Ucomponents of the second vector will hereinafter be denoted by Y1 andU1, respectively.

The U component U1 of the second vector has a correlation with the Zcomponent Z1 of the first vector. FIG. 10 is a waveform chart showingchanges in Z1 and U1 with respect to a change in the first angle θ1. InFIG. 10 , the horizontal axis indicates the first angle θ1, and thevertical axis indicates Z1 and U1. In FIG. 10 , a curve denoted by areference numeral 81 represents Z1, and a curve denoted by a referencenumeral 82 represents U1. In FIG. 10 , Z1 is normalized so that Z1 has amaximum value of 1 and a minimum value of −1. FIG. 10 shows U1 for acase where the dihedral angle α is 60°.

Z1 can be expressed by using U1 and the dihedral angle α. The ratioY1/Z1 can thus be expressed by using the ratio Y1/U1 and the dihedralangle α. An equation representing a relationship between the first angleθ1 and the second angle θ2 can be obtained by using a relationshipbetween the ratio Y1/Z1 and the first angle θ1, a relationship betweenthe ratio Y1/U1 and the second angle θ2, and a relationship between theratio Y1/Z1 and the ratio Y1/U1.

A value θ2 s representing the second angle θ2 can be determined by usingthe first detection signal S1. In the present embodiment, the detectionvalue generation unit 30 generates the detection value θs by determiningθ2 s and substituting θ2 s into the equation representing therelationship between the first angle θ1 and the second angle θ2.

Next, a specific method for calculating the detection value θs will bedescribed. The ratio Y1/Z1 and the ratio Y1/U1 are represented by thefollowing Eqs. (1) and (2), respectively:

Y1/Z1=tan θ1,  (1), and

Y1/U1=tan θ2.  (2)

Z1 is represented by the following Eq. (3):

Z1=U1/cos α.  (3)

Transforming Eq. (1) and substituting Eqs. (2) and (3) into thetransformed equation yields the following Eq. (4):

$\begin{matrix}\begin{matrix}{{\theta 1} = {a{\tan( {Y1/Z1} )}}} \\{= {a{\tan( {Y1/( {U1/\cos\alpha} )} )}}} \\{= {a{\tan( {\cos{\alpha \cdot Y}1/U1} )}}} \\{= {a{{\tan( {\cos{\alpha \cdot \tan}{\theta 2}} )}.}}}\end{matrix} & (4)\end{matrix}$

Eq. (4) represents the relationship between the first angle θ1 and thesecond angle θ2. The symbol “a tan” represents the arctangent.

The first detection signal S1 can be normalized so that the firstdetection signal S1 has a value of 1 if the second angle θ2 is 0°, avalue of −1 if the second angle θ2 is 180°, and a value of 0 if thesecond angle θ2 is 90° or 270°. In this case, the first detection signalS1 can be represented by the following Eq. (5):

S1=cos θ2.  (5)

FIG. 6 shows an example of the configuration of the detection valuegeneration unit 30. In this example, the detection value generation unit30 includes a first arithmetic unit 31 and a second arithmetic unit 32.The first arithmetic unit 31 calculates the value θ2 s representing thesecond angle θ2 on the basis of the first detection signal S1. Thesecond arithmetic unit 32 calculates the detection value θs on the basisof the value θ2 s calculated by the first arithmetic unit 31. The firstand second arithmetic units 31 and 32 may be functional blocks orphysically separate circuits.

The first arithmetic unit 31 calculates the value θ2 s by the followingEq. (6).

θ2s=a cos S1.  (6)

The range of the value θ2 s is 0° or more and not more than 180°. Eq.(6) is obtained by replacing θ2 in Eq. (5) with θ2 s and transformingthe resultant. The symbol “a cos” represents the arccosine.

The second arithmetic unit 32 calculates the detection value θs by thefollowing Eq. (7) excluding the exceptions to be described later:

θs=a tan(cos α·tan θ2s).  (7)

The range of the detection value θs is 0° or more and not more than180°. Eq. (7) is obtained by replacing θ1 and θ2 in Eq. (4) with θs andθ2 s respectively and transforming the resultant.

The foregoing exceptions refer to situations where the value θ2 s is 0°or 180°. If the value θ2 s is 0° or 180°, θs in Eq. (7) has twosolutions, 0° and 180°. The second arithmetic unit 32 then simply usesthe value θ2 s itself as the detection value θs if the value θ2 s is 0°or 180°. Such exception handling uses the fact that if the first angleθ1 is 0°, the second angle θ2 is also 0°, and if the first angle θ1 is180°, the second angle θ2 is also 180°.

The configuration and function of the detection value generation unit 30are not limited to the foregoing example. For example, the detectionvalue generation unit 30 may retain a table indicating thecorrespondence between the first detection signal S1 and the detectionvalue θs, and generate the detection value θs from the first detectionsignal S1 by referring to the table. The correspondence between thefirst detection signal S1 and the detection value θs in the foregoingtable may be theoretically determined as described above, or determinedby experiment.

Next, the operation and effect of the magnetic sensor system 1 and themagnetic sensor 2 according to the present embodiment will be described.The first magnetic detection unit 10 of the magnetic sensor 2 accordingto the present embodiment includes the MR element 11. The MR element 11includes the first magnetic layer having the first magnetization thatcan change in direction within a predetermined plane, namely, the secondplane PL2. The MR element 11 is thus suitable to detect the magneticfield that changes in direction within the predetermined plane, i.e.,the second plane PL2.

Meanwhile, the magnetic field to be detected MF at the referenceposition P0 has the first direction D1 that changes within apredetermined variable range in the first plane PL1 (YZ plane). In otherwords, the first direction D1 of the magnetic field to be detected MFchanges within a variable range including a direction outside theforegoing predetermined plane. According to the present embodiment, thedetection value θs corresponding to the first direction D1 of themagnetic field to be detected MF that changes in direction within thevariable range including a direction outside the predetermined plane,namely, the second plane PL2 can be generated by using the MR element 11suitable to detect a magnetic field that changes in direction within thepredetermined plane in the following manner.

In the present embodiment, the MR element 11 is located on the slope 3 bof the substrate 3, and the second plane PL2 corresponding to the MRelement 11 is tilted to form a dihedral angle α with respect to thefirst plane PL1. The MR element 11 can thus detect the in-planecomponent MFa that is a component of the magnetic field to be detectedMF. The second direction D2 that is the direction of the in-planecomponent MFa changes with a change in the first direction D1 that isthe direction of the magnetic field to be detected MF at the referenceposition P0. In the MR element 11, the direction of the firstmagnetization changes with a change in the second direction D2. Thedetection value θs depends on the direction of the first magnetization.The detection value θs therefore corresponds to the first direction D1.According to the present embodiment, the detection value θscorresponding to the first direction D1 can thus be generated by usingthe MR element 11.

Now, if the second plane PL2 is a plane perpendicular to the first planePL1, the strength of the in-plane component MFa may have a value of 0 ornear 0 depending on the first direction D1. An example of the case wherethe second plane PL2 is perpendicular to the first plane PL1 is wherethe second plane PL2 is a plane obtained by rotating the XY plane aboutan axis in the X direction by an angle greater than 0° and smaller than90°. In this case, the strength of the in-plane component MFa has avalue of 0 if the first direction D1 is perpendicular to the secondplane PL2, and a value near 0 if the first direction D1 is almostperpendicular to the second plane PL2. Thus, if the strength of thein-plane component MFa has a value of 0 or near 0, the detectionaccuracy of the magnetic sensor 2 drops greatly with respect tovariations in the strength of the magnetic field to be detected MF.

In the present embodiment, the first plane PL1 and the second plane PL2intersect at a dihedral angle α other than 90°. This prevents thestrength of the in-plane component MFa from becoming zero regardless ofthe first direction D1 within the variable range as long as there is amagnetic field to be detected MF. According to the present embodiment,the detection value θs corresponding to the first direction D1 of themagnetic field to be detected MF can thus be generated by using the MRelement 11 while suppressing a drop in the detection accuracy.

In the present embodiment, the first plane PL1 is perpendicular to themain surface 3 a of the substrate 3. According to the presentembodiment, the positional relationship between the magnetic sensor 2and the magnetic field generator 5 can therefore be easily defined.

A favorable range of the dihedral angle α will now be described.Assuming that the magnetic field to be detected MF has a strength of H1,the minimum value of the strength of the in-plane component MFa isH1·cos α. The minimum value of the strength of the in-plane componentMFa is preferably 10% or more of H1, more preferably 30% or more. Thedihedral angle α is thus preferably 84° or less, more preferably 73° orless. Too small a dihedral angle α can make it difficult to form the MRelement 11 on the slope 3 b of the substrate 3. The dihedral angle α istherefore preferably 30° or greater, more preferably 45° or greater. Insummary, the dihedral angle α is preferably in the range of 30° to 84°,more preferably in the range of 45° to 73°.

The direction of the first magnetization in the first magnetic layer ofthe MR element 11 preferably follows a change in the second direction D2of the in-plane component MFa with high accuracy. For that purpose, thefirst magnetic layer preferably has a characteristic that the firstmagnetization is saturated by the magnetic field to be detected MF ifthe first direction D1 of the magnetic field to be detected MF is in atleast a part of the variable range. The first magnetic layer morepreferably has a characteristic that the first magnetization issaturated by the magnetic field to be detected MF regardless of whatdirection within the variable range the first direction D1 is.

If the MR element 11 is a spin valve MR element, the first magneticlayer preferably has a small uniaxial magnetic anisotropy in order forthe direction of the first magnetization of the first magnetic layer tofollow a change in the second direction D2 with high accuracy.

The first magnetic layer of the MR element 11 may have a characteristicthat the first magnetization is saturated by the magnetic field to bedetected MF regardless of what direction within the variable range thefirst direction D1 is. In this case, the direction of the firstmagnetization of the first magnetic layer does not vary depending onvariations in the strength of the magnetic field to be detected MF. Thiscan reduce variations in the detection value θs due to variations in thestrength of the magnetic field to be detected MF. The strength of themagnetic field to be detected MF can vary, for example, due to a changein the ambient temperature and variations in the positional relationshipbetween the magnetic sensor 2 and the magnetic field generator 5.

In the present embodiment, the variable range of the first direction D1is 180° or less in size. In particular, in the present embodiment, asthe magnetic field generator 5 rotates about the rotation axis C, therelative rotational position of the magnetic field generator 5 withrespect to the magnetic sensor 2 changes, and as a result, the firstdirection D1 changes. The variable range of the relative rotationalposition of the magnetic field generator 5 with respect to the magneticsensor 2 is also 180° or less. The magnetic sensor system 1 according tothe present embodiment can thus be used as a device for detecting therotational position of a rotatable moving part in an apparatus thatincludes the moving part and where the variable range of the moving partis 180° or less. An example of such an apparatus is a throttle.

FIG. 11 is an explanatory diagram showing a configuration of a throttleto which the magnetic sensor system 1 according to the presentembodiment can be applied. A throttle 200 shown in FIG. 11 includes athrottle valve 201 that is a moving part and a main body 202 thatrotatably supports the throttle value 201 about a predetermined rotationaxis. If the magnetic sensor system 1 is applied to the throttle 200,for example, the magnetic sensor system 1 may be configured so that themagnetic field generator 5 rotates along with the throttle valve 201without the magnetic sensor 2 rotating along with the throttle valve201.

The variable range of the throttle valve 201 is 90° or less in size. Ifthe magnetic sensor system 1 is applied to the throttle 200, themagnetic sensor system 1 can be configured such that θ1 and θ2 shown inFIGS. 8 and 9 become 90° when the rotational position of the throttlevalve 201 comes to the center position of the variable range. Thisconfiguration can improve the linearity of change of the first detectionsignal S1 with respect to a change in the rotational position of thethrottle valve 201.

Another example of the apparatus to which the magnetic sensor system 1according to the present embodiment can be applied is a gearshift. Thegearshift includes a lever and a support unit that swingably supportsthe lever. If the magnetic sensor system 1 is applied to the gearshift,the magnetic sensor system 1 can be configured such that the magneticfield generator 5 rotates along with the lever without the magneticsensor 2 rotating along with the lever.

Second Embodiment

A second embodiment of the invention will now be described. Initially,differences of a magnetic sensor system 1 according to the presentembodiment from that according to the first embodiment will be describedwith reference to FIG. 12 . FIG. 12 is an explanatory diagram showing aschematic configuration of the magnetic sensor system 1.

The magnetic sensor system 1 according to the present embodimentincludes a magnetic field generator 105 that generates a magnetic fieldto be detected MF instead of the magnetic field generator 5 of the firstembodiment. The magnetic field generator 105 is rotatable about arotation axis C. The magnetic field generator 105 includes a pair ofmagnets 106A and 106B. The magnets 106A and 106B are located atpositions symmetrical about a virtual plane including the rotation axisC.

The magnets 106A and 106B each include an N pole and an S pole. Themagnets 106A and 106B are situated so that the N pole of the magnet 106Ais opposed to the S pole of the magnet 106B. In the present embodiment,the magnetic field generator 105 generates a magnetic field to bedetected MF directed from the N pole of the magnet 106A to the S pole ofthe magnet 106B.

The magnetic sensor 2 is configured such that the first direction D1(see FIGS. 3 and 8 ) of the magnetic field to be detected MF changes asthe relative position of the magnetic field generator 105 with respectto the magnetic sensor 2 changes. More specifically, as the magneticfield generator 105 rotates about the rotation axis C, the relativeposition of the magnetic field generator 105 with respect to themagnetic sensor 2 rotates about the magnetic sensor 2. The firstdirection D1 of the magnetic field to be detected MF thus rotates aboutthe reference position P0.

In the present embodiment, the variable range of the first direction D1and the variable ranges of the magnets 106A and 106B are all within360°. The magnetic sensor system 1 according to the present embodimentcan thus be used as a device for detecting the rotational position of arotatable moving part in an apparatus that includes the moving part andthe variable range of the moving part is within 360°. Examples of suchan apparatus include a joint of an industrial robot. FIG. 12 shows anexample where the magnetic sensor system 1 is applied to an industrialrobot 300.

The industrial robot 300 shown in FIG. 12 includes a moving part 301 anda support unit 302 that rotatably supports the moving part 301. Themoving part 301 and the support unit 302 are connected at a joint. Themoving part 301 rotates about a rotation axis C. The variable range ofthe moving part 301 is within 360°. For example, if the magnetic sensorsystem 1 according to the present embodiment is applied to the joint ofthe industrial robot 300, the magnetic sensor 2 may be fixed to thesupport unit 302, and the magnets 106A and 106B may be fixed to themoving part 301.

Next, differences of the magnetic sensor 2 according to the presentembodiment from that according to the first embodiment will be describedwith reference to FIGS. 13 and 14 . FIG. 13 is a perspective viewshowing the magnetic sensor 2. FIG. 14 is a circuit diagram showing aconfiguration of the magnetic sensor 2. As shown in FIG. 14 , themagnetic sensor 2 according to the present embodiment includes a secondmagnetic detection unit 20 aside from the first magnetic detection unit10 and the detection value generation unit 30. The second magneticdetection unit 20 detects the magnetic field to be detected MF andgenerates a second detection signal S2 dependent on the first directionD1. In the present embodiment, the detection value generation unit 30generates the detection value θs on the basis of the first detectionsignal S1 and the second detection signal S2. The detection value θscorresponds to a relative position, or rotational position inparticular, of the magnetic field generator 105 with respect to themagnetic sensor 2.

The second magnetic detection unit 20 includes an MR element 21 shown inFIGS. 13 and 14 . The MR element 21 is located on the main surface 3 aof the substrate 3. The second magnetic detection unit 20 furtherincludes a resistor 22, a signal output node E2, a power supply node V2,and a ground node G2. The MR element 21 and the resistor 22 areconnected in series via the signal output node E2. The resistor 22 isarranged between the power supply node V2 and the signal output node E2.The MR element 21 is arranged between the signal output node E2 and theground node G2. A predetermined magnitude of power supply voltage isapplied to the power supply node V2. The ground node G2 is grounded.

The MR element 11 of the first magnetic detection unit 10 and the MRelement 21 of the second magnetic detection unit 20 are located withinan area where no substantial difference occurs in the direction of themagnetic field to be detected MF depending on the positions where the MRelements 11 and 21 receive the magnetic field to be detected MF. Thedirections of the magnetic field to be detected MF received by the MRelements 11 and 21 are thus substantially the same.

In the present embodiment, the MR element 21 is a spin valve MR elementlike the MR element 11. The MR element 21 includes a third magneticlayer, a fourth magnetic layer, and a gap layer. The third magneticlayer has third magnetization that can change in direction within avirtual plane parallel to the reference plane PL3 (XY plane). The fourthmagnetic layer has fourth magnetization in a direction parallel to theforegoing virtual plane. The gap layer is located between the third andfourth magnetic layers. The resistance of the MR element 21 changes withan angle that the direction of the third magnetization of the thirdmagnetic layer forms with respect to the direction of the fourthmagnetization of the fourth magnetic layer. The resistance is minimizedif the angle is 0°. The resistance is maximized if the angle is 180°. InFIGS. 13 and 14 , the thick arrow in the MR element 21 indicates thedirection of the fourth magnetization of the fourth magnetic layer. Inthe present embodiment, the direction of the fourth magnetization of thefourth magnetic layer is the −Y direction.

From the viewpoint of the manufacturing accuracy of the MR element 21,the direction of the fourth magnetization may be slightly different fromthe foregoing direction.

The third magnetic layer may have uniaxial magnetic anisotropy in adirection parallel to the X direction. The uniaxial magnetic anisotropymay be shape magnetic anisotropy. In this case, the direction of thethird magnetization of the third magnetic layer changes with a change inthe strength of a component of the magnetic field to be detected MF in adirection parallel to the Y direction. The component of the magneticfield to be detected MF in the direction parallel to the Y directionwill hereinafter be referred to as a Y-direction component. The strengthof the Y-direction component is expressed in positive values if thedirection of the Y-direction component is the Y direction. The strengthof the Y-direction component is expressed in negative values if thedirection of the Y-direction component is the −Y direction. The strengthof the Y-direction component depends on the first angle θ1 (see FIG. 8 )that the first direction D1 forms with respect to the Z direction. Morespecifically, assuming the strength of the magnetic field to be detectedMF is H1, the strength of the Y-direction component is given by H1·sinθ1. The direction of the third magnetization of the third magnetic layerthus depends on H1·sin θ1.

The potential of the signal output node E2 of the second magneticdetection unit 20 depends on the resistance of the MR element 21. Theresistance of the MR element 21 depends on H1·sin θ1. The secondmagnetic detection unit 20 generates a signal corresponding to thepotential of the signal output node E2 as the second detection signalS2. In particular, in the present embodiment, the second detectionsignal S2 is normalized to sin θ1.

Like the first embodiment, the first detection signal S1 generated bythe first magnetic detection unit 10 is normalized as represented by Eq.(5).

FIG. 15 is a waveform chart showing a relationship between the secondangle θ2 and the first detection signal S1. FIG. 16 is a waveform chartshowing a relationship between the first angle θ1 and the seconddetection signal S2. If the first angle θ1 is 0°, the second angle θ2 isalso 0°. If the first angle θ1 is 90°, the second angle θ2 is also 90°.If the first angle θ1 is 180°, the second angle θ2 is also 180°. If thefirst angle θ1 is 270°, the second angle θ2 is also 270°. In terms ofboth angles θ1 and θ2, 360° is equivalent to 0°. In the followingdescription, items applicable to both 0° and 360° in terms of the anglesθ1 and θ2 will therefore be only described for 0°.

Next, a method for generating the detection value θs of the presentembodiment will be described. In the present embodiment, the variablerange of the first direction D1 includes a first region R1 and a secondregion R2 that are different from each other. As described above, thevariable range of the first direction D1 is within 360°. The first angleθ1 will hereinafter be assumed to change within the variable range of 0°or greater and not greater than 360°. Here, a range of the firstdirection D1 where the first angle θ1 is greater than 0° and smallerthan 180° will be referred to as the first region R1. A range of thefirst direction D1 where the first angle θ1 is greater than 180° andsmaller than 360° will be referred to as the second region R2. If thefirst direction D1 is in the first region R1, both the first and secondangles θ1 and θ2 fall within the range of greater than 0° and smallerthan 180°. If the first direction D1 is in the second region R2, boththe first and second angles θ1 and θ2 fall within the range of greaterthan 180° and smaller than 360°.

As shown in FIG. 15 , the first detection signal S1 changes with achange in the second angle θ2. Like the first angle θ1, the second angleθ2 changes within the variable range of 0° or greater and not greaterthan 360°. There are two values of the second angle θ2 at which thefirst detection signal S1 has a specific same value, within the variablerange of the second angle θ2 except 0° and 180°. Similarly, there aretwo values of the first angle θ1 at which the first detection signal S1has the specific same value, within the variable range of the firstangle θ1 except 0° and 180°. In other words, there are two candidatesfor the first direction D1 corresponding to a specific same value of thefirst detection signal S1, within the variable range of the first angleθ1 except 0° and 180°. One of the two candidates is in the first regionR1, and the other thereof is in the second region R2. If the first angleθ1 changes within the variable range of 0° or greater and not greaterthan 360° and the first angle θ1 is other than 0° or 180°, the firstdirection D1 is unable to be identified by using only the firstdetection signal S1.

In the present embodiment, the detection value θs corresponding to thefirst direction D1 on a one-to-one basis can be generated on the basisof the first and second detection signals S1 and S2. In other words,according to the present embodiment, the first direction D1 can beidentified on the basis of the first and second detection signals S1 andS2. A detailed description thereof is given below.

As shown in FIG. 16 , the second detection signal S2 has a positivevalue if the first direction D1 is in the first region R1, i.e., thefirst angle θ1 is greater than 0° and smaller than 180°. The seconddetection signal S2 has a negative value if the first direction D1 is inthe second region R2, i.e., the first angle θ1 is greater than 180° andsmaller than 360°. The second detection signal S2 thus has two differentvalues corresponding to the two candidates for the first direction D1corresponding to a specific same value of the first detection signal S1.Which of the two candidates for the first direction D1 is the true firstdirection D1 can therefore be found out by using the second detectionsignal S2. Specifically, if the second detection signal S2 has apositive value, the candidate for the first direction D1 in the firstregion R1 is the true first direction D1. If the second detection signalS2 has a negative value, the candidate for the first direction D1 in thesecond region R2 is the true first direction D1. In such a manner,according to the present embodiment, the first direction D1 can beidentified on the basis of the first and second detection signals S1 andS2.

In the present embodiment, the detection value generation unit 30generates the detection value θs corresponding to the first direction D1on a one-to-one basis by using the foregoing characteristic. Now, firstand second examples of the configuration and processing content of thedetection value generation unit 30 will be described. In the first andsecond examples, as shown in FIG. 14 , the detection value generationunit 30 includes a comparator 33 and an angle calculation unit 34. Thecomparator 33 determines whether the value of the second detectionsignal S2 is greater than or equal to 0, and outputs the determinationresult.

In the first example, the angle calculation unit 34 initially calculatesthe value θ2 s representing the second angle θ2 on the basis of thefirst detection signal S1 by using Eq. (6) in the first embodiment. Inthe first example, the range of the value θ2 s is 0° or greater and notgreater than 180°. The angle calculation unit 34 then calculates thedetection value θs by using Eq. (7) in the first embodiment, excludingthe exceptions to be described later. In the present embodiment, therange of the detection value θs is 0° or greater and smaller than 360°.Like the first embodiment, the foregoing exceptions refer to situationswhere the value θ2 s is 0° or 180°. If the value θ2 s is 0° or 180°, theangle calculation unit 34 simply uses the value θ2 s as the detectionvalue θs.

In the first example, θs in Eq. (7) has two solutions except theexceptions. One of the two solutions is in the range of greater than 0°and smaller than 180°. The other is in the range of greater than 180°and smaller than 360°. The angle calculation unit 34 then determineswhich of the two solutions of θs in Eq. (7) is the true value of θs byusing the determination result of the comparator 33. Specifically, ifthe second detection signal S2 has a value of 0 or more, the anglecalculation unit 34 selects the solution in the range of greater than 0°and smaller than 180° as θs. If the second detection signal S2 has anegative value, the angle calculation unit 34 selects the solution inthe range of greater than 180° and smaller than 360° as θs.

In the second example, the angle calculation unit 34 initiallycalculates the value θ2 s on the basis of the first detection signal S1by using Eq. (6) in the first embodiment. In the second example, therange of the value θ2 s is 0° or greater and smaller than 360°. θ2 s inEq. (6) has two solutions except the exceptions when the value θ2 s isother than 0° and 180°. One of the two solutions is in the range ofgreater than 0° and smaller than 180°. The other is in the range ofgreater than 180° and smaller than 360°. The angle calculation unit 34determines which of the two solutions of θ2 s in Eq. (6) is the truevalue of θ2 s by using the determination result of the comparator 33.Specifically, if the second detection signal S2 has a value of 0 ormore, the angle calculation unit 34 selects the solution in the range ofgreater than 0° and smaller than 180° as θ2 s. If the second detectionsignal S2 has a negative value, the angle calculation unit 34 selectsthe solution in the range of greater than 180° and smaller than 360° asθ2 s. If the value θ2 s is 0° or 180°, the angle calculation unit 34simply uses the value θ2 s as the detection value θs.

Next, the angle calculation unit 34 calculates the detection value θs byusing Eq. (7) in the first embodiment. The range of the detection valueθs is 0° or greater and smaller than 360°. θs in Eq. (7) has twosolutions. One of the two solutions is in the range of greater than 0°and smaller than 180°. The other is in the range of greater than 180°and smaller than 360°. The angle calculation unit 34 selects the closerof the two solutions to the value of θ2 s as θs.

The configuration, operation and effects of the present embodiment areotherwise the same as those of the first embodiment.

Third Embodiment

A third embodiment of the invention will now be described. Initially,differences of a magnetic sensor 2 according to the present embodimentfrom that according to the second embodiment will be described withreference to FIG. 17 . FIG. 17 is a perspective view showing themagnetic sensor 2. As shown in FIG. 17 , in the present embodiment, theMR element 21 of the second magnetic detection unit 20 of the magneticsensor 2 is located on the slope 3 b of the substrate 3 like the MRelement 11 of the first magnetic detection unit 10 of the magneticsensor 2.

Like the second embodiment, the MR elements 11 and 21 are located withinan area where no substantial difference occurs in the direction of themagnetic field to be detected MF depending on the positions where the MRelements 11 and 21 receive the magnetic field to be detected MF. Thedirections of the magnetic field to be detected MF received by the MRelements 11 and 21 are thus substantially the same.

In the present embodiment, the third magnetization of the third magneticlayer of the MR element 21 can change in direction within the same planeas the second plane PL2 (see FIGS. 3 and 4 ) corresponding to the MRelement 11 or within a plane parallel to the second plane PL2. Thedirection of the third magnetization changes with a change in the seconddirection D2 (see FIGS. 3 and 9 ) of the in-plane component MFa of themagnetic field to be detected MF received by the MR element 11. Thedirection of the third magnetization preferably follows the change inthe second direction D2 with high accuracy. For that purpose, the thirdmagnetic layer preferably has a characteristic that the thirdmagnetization is saturated by the magnetic field to be detected MF ifthe first direction D1 of the magnetic field to be detected MF is in atleast part of the variable range. The third magnetic layer morepreferably has a characteristic that the third magnetization issaturated by the magnetic field to be detected MF regardless of whatdirection within the variable range the first direction D1 is.

As described in the second embodiment, the MR element 11 is a spin valveMR element. The third magnetic layer preferably has a small uniaxialmagnetic anisotropy so that the direction of the third magnetization ofthe third magnetic layer follows a change in the second direction D2with high accuracy.

As described in the first embodiment, the second direction D2 changeswith a change in the first direction D1 (see FIGS. 3 and 8 ) of themagnetic field to be detected MF. The resistance of the MR element 21thus changes with a change in the first direction D1, and as a result,the signal output node E2 (see FIG. 13 ) of the second magneticdetection unit 20 changes in potential. The second magnetic detectionunit 20 generates a signal corresponding to the potential of the signaloutput node E2 as the second detection signal S2. The second detectionsignal S2 changes with a change in the first direction D1.

As described in the second embodiment, the direction of the fourthmagnetization in the fourth magnetic layer of the MR element 21 is the−Y direction. The direction of the fourth magnetization does not changewith a change in the second direction D2 of the in-plane component MFa.The second detection signal S2 can be normalized so that the seconddetection signal S2 has a value of 0 if the second angle θ2 (see FIG. 9) that the second direction D2 forms with respect to the U direction is0° or 180°, a value of 1 if the second angle θ2 is 90°, and a value of−1 if the second angle θ2 is 270°. In this case, the second detectionsignal S2 is represented by the following Eq. (8):

S2=sin θ2.  (8)

Next, a method for generating the detection value θs of the presentembodiment will be described. As described in the second embodiment,there are two candidates for the first direction D1 corresponding to aspecific same value of the first detection signal S1 within the variablerange of the first angle θ1 except 0° and 180°. One of the twocandidates is in the first region R1, and the other is in the secondregion R2.

From Eq. (8), the second detection signal S2 has a positive value if thefirst direction D1 is in the first region R1, i.e., the second angle θ2is greater than 0° and smaller than 180°. The second detection signal S2has a negative value if the first direction D1 is in the second regionR2, i.e., the second angle θ2 is greater than 180° and smaller than360°. The second detection signal S2 thus has two different valuescorresponding to the two candidates for the first direction D1corresponding to a specific same value of the first detection signal S1.Which of the two candidates for the first direction D1 is the true firstdirection D1 can therefore be found out by using the second detectionsignal S2. Specifically, if the second detection signal S2 has apositive value, the candidate for the first direction D1 in the firstregion R1 is the true first direction D1. If the second detection signalS2 has a negative value, the candidate for the first direction D1 in thesecond region R2 is the true first direction D1. In this manner,according to the present embodiment, the first direction D1 can beidentified on the basis of the first and second detection signals S1 andS2.

In the present embodiment, the detection value generation unit 30generates the detection value θs corresponding to the first direction D1on a one-to-one basis by using the foregoing characteristic. First andsecond examples of the configuration and processing content of thedetection value generation unit 30 in the present embodiment will now bedescribed. In the first and second examples, like the second embodiment,the detection value generation unit 30 includes the comparator 33 andthe angle calculation unit 34 shown in FIG. 14 . However, in the presentembodiment, the angle calculation unit 34 calculates the value θ2 s onthe basis of the first and second detection signals S1 and S2 by usingthe following Eq. (9) instead of Eq. (6) in the second embodiment:

θ2s=a tan(S2/S1).  (9)

In other respects, the first and second examples in the presentembodiment are the same as those in the second embodiment.

The configuration, operation and effects of the present embodiment areotherwise the same as those of the second embodiment.

Fourth Embodiment

A fourth embodiment of the invention will now be described. A magneticsensor 2 according to the present embodiment has the same configurationas that according to any one of the first to third embodiments exceptthat the configuration of the first magnetic detection unit 10 isdifferent.

FIG. 18 is a perspective view showing at least a part of the magneticsensor 2. FIG. 19 is a circuit diagram showing a configuration of thefirst magnetic detection unit 10 of the magnetic sensor 2. As shown inFIG. 19 , in the present embodiment, the first magnetic detection unit10 of the magnetic sensor 2 includes a first MR element 13 and a secondMR element 14 instead of the MR element 11 and the resistor 12 of thefirst embodiment. Since the first magnetic detection unit 10 is a partof the magnetic sensor 2, the magnetic sensor 2 can be said to includethe first and second MR elements 13 and 14.

All the MR elements included in the magnetic sensor 2 are located withinan area where no substantial difference occurs in the direction of themagnetic field to be detected MF depending on the positions where allthe MR elements receive the magnetic field to be detected MF. Thedirections of the magnetic field to be detected MF received by all theMR elements are thus substantially the same.

In the present embodiment, the substrate 3 of the magnetic sensor 2supports the first and second MR elements 13 and 14. As shown in FIG. 18, the first and second MR elements 13 and 14 are located on the slope 3b of the substrate 3. In the present embodiment, the reference positionP0 (see FIGS. 3 and 4 ) may be the position where the first MR element13 or the second MR element 14 is located, or an intermediate positionbetween the first and second MR elements 13 and 14.

As shown in FIG. 19 , the first and second MR elements 13 and 14 areconnected in series via the signal output node E1. The first MR element13 is arranged between the power supply node V1 and the signal outputnode E1. The second MR element 14 is arranged between the signal outputnode E1 and the ground node G1.

In the present embodiment, a common second plane PL2 is defined for thefirst and second MR elements 13 and 14. In the present embodiment, onesecond plane PL2 therefore serves both as a second plane correspondingto the first MR element 13 and as a second plane corresponding to thesecond MR element 14. The second plane PL2 of the present embodiment isthe same as that corresponding to the MR element 11 of the firstembodiment (see FIGS. 3 and 4 ).

In the present embodiment, the second direction of the in-planecomponent of the magnetic field to be detected MF received by the firstMR element 13 and the second direction of the in-plane component of themagnetic field to be detected MF received by the second element 14 arethe same as the second direction D2 of the first embodiment, shown inFIG. 3 .

The first and second MR elements 13 and 14 each have the sameconfiguration as that of the MR element 11 of the first embodiment. Morespecifically, the first and second MR elements 13 and 14 each include afirst magnetic layer, a second magnetic layer, and a gap layer. Thefirst magnetic layer has first magnetization that can change indirection within the second plane PL2. The second magnetic layer hassecond magnetization in a direction parallel to the second plane PL2.The gap layer is located between the first and second magnetic layers.In FIGS. 18 and 19 , the thick arrows indicate the directions of thesecond magnetization in the respective second magnetic layers. In thepresent embodiment, the direction of the second magnetization in thesecond magnetic layer of the first MR element 13 is the U direction. Thedirection of the second magnetization in the second magnetic layer ofthe second MR element 14 is the −U direction.

In each of the first and second MR elements 13 and 14, the direction ofthe first magnetization of the first magnetic layer changes with achange in the second direction D2 (see FIGS. 3 and 9 ) of the in-planecomponent MFa of the magnetic field to be detected MF. The seconddirection D2 changes with a change in the first direction D1 (see FIGS.3 and 8 ) of the magnetic field to be detected MF. The resistances ofthe respective first and second MR elements 13 and 14 thus change with achange in the first direction D1. In the present embodiment, as thefirst direction D1 changes, either one of the resistances of the firstand second MR elements 13 and 14 increases and the other decreases. Thischanges the potential of the signal output node E1. Like the firstembodiment, the first magnetic detection unit 10 generates a signalcorresponding to the potential of the signal output node E1 as the firstdetection signal S1. In the present embodiment, the detection value θsdepends on the potential of the signal output node E1.

From the viewpoint of the manufacturing accuracy of the MR elements 13and 14, the direction of the second magnetization may be slightlydifferent from the foregoing direction.

The remainder of configuration, function and effects of the presentembodiment are similar to those of any of the first to thirdembodiments.

Fifth Embodiment

A fifth embodiment of the invention will now be described. Initially,differences of a magnetic sensor 2 according to the present embodimentfrom that according to the fourth embodiment will be described withreference to FIGS. 20 and 21 . FIG. 20 is a perspective view showing themagnetic sensor 2. FIG. 21 is a sectional view showing a cross sectionof the magnetic sensor 2. In the present embodiment, the groove portion3 c in the substrate 3 of the magnetic sensor 2 includes a first slope 3d and a second slope 3 e both oblique to the main surface 3 a, insteadof the slope 3 b of the first embodiment. Both the first and secondslopes 3 d and 3 e are flat surfaces. The first and second slopes 3 dand 3 e are symmetrical about the YZ plane therebetween.

Like the fourth embodiment, all the MR elements included in the magneticsensor 2 are located within an area where no substantial differenceoccurs in the direction of the magnetic field to be detected MFdepending on the positions where all the MR elements receive themagnetic field to be detected MF. The directions of the magnetic fieldto be detected MF received by all the MR elements are thus substantiallythe same.

The first MR element 13 of the first magnetic detection unit 10 of themagnetic sensor 2 is located on the first slope 3 d. The second MRelement 14 of the first magnetic detection unit 10 of the magneticsensor 2 is located on the second slope 3 e. FIG. 21 shows a crosssection of the magnetic sensor 2 parallel to the XZ plane, where thefirst and second MR elements 13 and 14 intersect.

As shown in FIG. 21 , in the present embodiment, different second planesPL21 and PL22 are defined for the first and second MR elements 13 and14, respectively. The second plane PL21 corresponding to the first MRelement 13 is the same as the second plane PL2 (see FIGS. 3 and 4 )corresponding to the MR element 11 according to the first embodiment.The second plane PL21 is thus a UY plane that intersects the first planePL1 at a dihedral angle α.

The second plane PL22 corresponding to the second MR element 14 issymmetrical with the second plane PL21 about the YZ plane. As shown inFIG. 21 , a direction rotated from the Z direction toward the Xdirection by α will be referred to as a V direction. The directionopposite to the V direction will be referred to as a −V direction. Thesecond plane PL22 is a plane that intersects the first plane PL1 at adihedral angle α and that is parallel to the V direction and the Ydirection, i.e., a VY plane.

The first slope 3 d is tilted to form a dihedral angle α with respect tothe first plane PL1 and is parallel to the UY plane. The second planePL21 is thus parallel to the first slope 3 d.

The second slope 3 e is tilted to form a dihedral angle α with respectto the first plane PL1 and is parallel to the VY plane. The second planePL22 is thus parallel to the second slope 3 e.

In the present embodiment, the first magnetic layer of the first MRelement 13 has first magnetization that can change in direction withinthe second plane PL21 corresponding to the first MR element 13. Themagnetic field to be detected MF received by the first MR element 13 canbe divided into an in-plane component (hereinafter, referred to as afirst in-plane component) parallel to the second plane PL21 and aperpendicular component perpendicular to the second plane PL21. Thefirst in-plane component has a second direction that changes with achange in the first direction D1 of the magnetic field to be detectedMF. The first magnetization of the first magnetic layer of the first MRelement 13 changes in direction with a change in the second direction ofthe first in-plane component. In the present embodiment, the angle thatthe second direction of the first in-plane component forms with respectto the U direction will be referred to as a second angle θ2. Thepositive and negative signs of the angle that the second direction ofthe first in-plane component forms with respect to the U direction aredefined the same as those of the second angle θ2 described in the firstembodiment.

In the present embodiment, the first magnetic layer of the second MRelement 14 has first magnetization that can change in direction withinthe second plane PL22 corresponding to the second MR element 14. Themagnetic field to be detected MF received by the second MR element 14can be divided into an in-plane component (hereinafter, referred to as asecond in-plane component) parallel to the second plane PL22 and aperpendicular component perpendicular to the second plane PL22. Thesecond in-plane component has a second direction that changes with achange in the first direction D1 of the magnetic field to be detectedMF. The first magnetization of the first magnetic layer of the second MRelement 14 changes in direction with a change in the second direction ofthe second in-plane component.

The angle that the second direction of the second in-plane componentforms with respect to the V direction will be referred to as a thirdangle. Within the second plane PL22 corresponding to the second MRelement 14, the second direction of the second in-plane componentrotates about the position where the second MR element 14 is located.The third angle is expressed in positive values when seen in a directionof rotation from the V direction to the Y direction, and expressed innegative values when seen in a direction of rotation from the Vdirection to the −Y direction. The third angle is equal to the secondangle θ2.

In FIGS. 20 and 21 , the thick arrows indicate the directions of thesecond magnetization in the respective second magnetic layers of thefirst and second MR elements 13 and 14. The direction of the secondmagnetization in the second magnetic layer of the first MR element 13 isthe U direction. The direction of the second magnetization in the secondmagnetic layer of the second MR element 14 is the −V direction. In thepresent embodiment, as the first direction D1 changes, either one of theresistances of the first and second MR elements 13 and 14 increases andthe other decreases. This changes the potential of the signal outputnode E1 (see FIG. 19 ). The first magnetic detection unit 10 generates asignal corresponding to the potential of the signal output node E1 asthe first detection signal S1. In the present embodiment, the detectionvalue θs depends on the potential of the signal output node E1.

From the viewpoint of the manufacturing accuracy of the MR elements 13and 14, the direction of the second magnetization may be slightlydifferent from the foregoing direction.

The configuration, operation and effects of the present embodiment areotherwise the same as those of the fourth embodiment.

Sixth Embodiment

A sixth embodiment of the invention will now be described. Initially,differences of a magnetic sensor 2 according to the present embodimentfrom that according to the fifth embodiment will be described withreference to FIG. 22 . FIG. 22 is a circuit diagram showing aconfiguration of a first magnetic detection unit 10 of the magneticsensor 2. As shown in FIG. 22 , in the present embodiment, the firstmagnetic detection unit 10 of the magnetic sensor 2 includes a resistor15 aside from the first MR element 13, the second MR element 14, thesignal output node E1, the power supply node V1, and the ground node G1.The resistor 15, the first MR element 13, and the second MR element 14are connected in series in this order from the power supply node V1side. The resistor 15 is arranged between the power supply node V1 andthe signal output node E1. The first and second MR elements 13 and 14are arranged between the signal output node E1 and the ground node G1.

Like the fifth embodiment, all the MR elements included in the magneticsensor 2 are located within an area where no substantial differenceoccurs in the direction of the magnetic field to be detected MFdepending on the positions where all the MR elements receive themagnetic field to be detected MF. The directions of the magnetic fieldto be detected MF received by all the MR elements are thus substantiallythe same.

In FIG. 22 , the thick arrows indicate the directions of the secondmagnetization in the respective second magnetic layers of the first andsecond MR elements 13 and 14. In the present embodiment, the directionof the second magnetization in the second magnetic layer of the first MRelement 13 is the −U direction (see FIG. 21 ). The direction of thesecond magnetization in the second magnetic layer of the second MRelement 14 is the −V direction (see FIG. 21 ).

In the present embodiment, the resistances of the respective first andsecond MR elements 13 and 14 change similarly with a change in the firstdirection D1 of the magnetic field to be detected MF. As the firstdirection D1 changes, the combined resistance of the first and second MRelements 13 and 14 therefore changes. This changes the potential of thesignal output node E1. The first magnetic detection unit 10 generates asignal dependent on the potential of the signal output node E1 as thefirst detection signal S1. In the present embodiment, the detectionvalue θs depends on the combined resistance of the first and second MRelements 13 and 14.

From the viewpoint of the manufacturing accuracy of the MR elements 13and 14, the direction of the second magnetization may be slightlydifferent from the foregoing direction.

Next, characteristic operation and effect of the magnetic sensor 2according to the present embodiment will be described. The main surface3 a of the substrate 3 is ideally parallel to the reference plane PL3(XY plane) of the first embodiment, shown in FIGS. 3 and 4 . However,the magnetic sensor 2 can be tilted because of installation accuracy ofthe magnetic sensor 2, and as a result, the main surface 3 a of thesubstrate 3 can be tilted with respect to the reference plane PL3. Inthis case, the dihedral angle (hereinafter, referred to as a firstdihedral angle) that the second plane PL21 (see FIG. 21) correspondingto the first MR element 13 forms with respect to the first plane PL1 (YZplane) and the dihedral angle (hereinafter, referred to as a seconddihedral angle) that the second plane PL22 (see FIG. 21 ) correspondingto the second MR element 14 forms with respect to the first plane PL1deviate from their design values.

If the first dihedral angle deviates from its design value, the seconddirection of the first in-plane component of the magnetic field to bedetected MF received by the first MR element 13 deviates from a desireddirection. The direction of the first magnetization in the firstmagnetic layer of the first MR element 13 then deviates from a desireddirection, and as a result, the resistance of the first MR element 13deviates from a desired value.

Similarly, if the second dihedral angle deviates from its design value,the second direction of the second in-plane component of the magneticfield to be detected MF received by the second MR element 14 deviatesfrom a desired direction. The direction of the first magnetization inthe first magnetic layer of the second MR element 14 then deviates froma desired direction, and as a result, the resistance of the second MRelement 14 deviates from a desired value.

In the present embodiment, when either one of the first and seconddihedral angles becomes greater than its design value due to the tilt ofthe magnetic sensor 2, the other becomes smaller than its design value.Consequently, when either one of the resistances of the first and secondMR elements 13 and 14 becomes greater than a desired value due to thetilt of the magnetic sensor 2, the other becomes smaller than a desiredvalue. According to the present embodiment, the combined resistance ofthe first and second MR elements 13 and 14 does not vary much because ofthe tilt of the magnetic sensor 2. According to the present embodiment,the detection accuracy can thus be prevented from dropping due to thetilt of the magnetic sensor 2.

The configuration, operation and effects of the present embodiment areotherwise the same as those of the fifth embodiment.

Seventh Embodiment

A seventh embodiment of the invention will now be described. A magneticsensor system 1 according to the present embodiment differs from that ofthe second embodiment in the following respects. The magnetic sensorsystem 1 according to the present embodiment includes a magnetic sensor102 according to the present embodiment instead of the magnetic sensor 2according to the second embodiment. A positional relationship betweenthe magnetic sensor 102 and the magnetic field generator 105 is the sameas that between the magnetic sensor 2 and the magnetic field generator105 in the second embodiment, shown in FIG. 12 . The magnetic sensor 102detects the magnetic field to be detected MF generated by the magneticfield generator 105 and generates a detection value θs.

A configuration of the magnetic sensor 102 will be described below withreference to FIGS. 23 to 28 . FIG. 23 is a perspective view showing themagnetic sensor 102. FIG. 24 is a sectional view showing a cross sectionof the magnetic sensor 102. FIG. 25 is a sectional view showing anothercross section of the magnetic sensor 102. FIG. 26 is a block diagramshowing the configuration of the magnetic sensor 102. FIG. 27 is acircuit diagram showing a configuration of a first magnetic detectionunit of the present embodiment. FIG. 28 is a circuit diagram showing aconfiguration of a second magnetic detection unit of the presentembodiment.

As shown in FIG. 26 , the magnetic sensor 102 includes a first magneticdetection unit 110, a second magnetic detection unit 120, and adetection value generation unit 130. The first magnetic detection unit110 generates a first detection signal S11. The second magneticdetection unit 120 generates a second detection signal S12. Thedetection value generation unit 130 generates the detection value θs onthe basis of the first detection signal S11 and the second detectionsignal S12. The detection value generation unit 130 includes an ASIC ora microcomputer.

As will be described in detail later, the first magnetic detection unit110 includes eight MR elements. The second magnetic detection unit 120includes four MR elements. The MR elements are located within an areawhere no substantial difference occurs in the direction of the magneticfield to be detected MF depending on the positions where the pluralityof MR elements receive the magnetic field to be detected MF. Thedirections of the magnetic field to be detected MF received by the MRelements are therefore substantially the same.

As shown in FIGS. 23 to 25 , the magnetic sensor 102 further includes asubstrate 103. The substrate 103 includes a main surface 103 aperpendicular to the first plane PL1 (YZ plane) of the first embodiment,shown in FIGS. 3 and 4 . The substrate 103 also has two groove portions103 f and 103 g open in the main surface 103 a. The groove portions 103f and 103 g are arranged in this order along the X direction. The grooveportion 103 f includes a first slope 103 b and a second slope 103 c eachoblique to the main surface 103 a. The groove portion 103 g includes afirst slope 103 d and a second slope 103 e each oblique to the mainsurface 103 a. The first and second slopes 103 b and 103 c aresymmetrical about a YZ plane therebetween. Similarly, the first andsecond slopes 103 d and 103 e are symmetrical about a YZ planetherebetween.

As shown in FIG. 27 , the first magnetic detection unit 110 includeseight MR elements 111, 112, 113, 114, 115, 116, 117, and 118. Thesubstrate 103 supports the MR elements 111 to 118. In the example shownin FIG. 23 , the MR elements 111 to 114 are arranged in a row in thisorder along the X direction. In the example shown in FIG. 23 , the MRelements 115 to 118 are arranged in a row in this order along the Xdirection, at positions on the −Y direction side of the MR elements 111to 114. As shown in FIG. 23 , the MR elements 111 and 115 are located onthe first slope 103 b. The MR elements 112 and 116 are located on thesecond slope 103 c. The MR elements 113 and 117 are located on the firstslope 103 d. The MR elements 114 and 118 are located on the second slope103 e. FIG. 24 shows a cross section of the magnetic sensor 102 parallelto the XZ plane, intersecting the MR elements 111 to 114. FIG. 25 showsa cross section of the magnetic sensor 102 parallel to the XZ plane,intersecting the MR elements 115 to 118. In the present embodiment, thereference position P0 (see FIGS. 3 and 4 ) is located inside or at thesurface of the magnetic sensor 102.

As shown in FIG. 27 , the first magnetic detection unit 110 furtherincludes two signal output nodes E11 and E12, a power supply node V11, aground node G11, and a differential detector 119. The MR elements 111,112, 113, and 114 are connected in series in this order from the powersupply node V11 side. The MR elements 111 and 112 are arranged betweenthe power supply node V11 and the signal output node E11. The MRelements 113 and 114 are arranged between the signal output node E11 andthe ground node G11. The MR elements 112 and 113 are connected in seriesvia the signal output node E11.

The MR elements 115, 116, 117, and 118 are connected in series in thisorder from the power supply node V11 side. The MR elements 115 and 116are arranged between the power supply node V11 and the signal outputnode E12. The MR elements 117 and 118 are arranged between the signaloutput node E12 and the ground node G12. The MR elements 116 and 117 areconnected in series via the signal output node E12.

A predetermined magnitude of power supply voltage is applied to thepower supply node V11. The ground node G11 is grounded. The differentialdetector 119 outputs a signal corresponding to a potential differencebetween the signal output nodes E11 and E12 as the first detectionsignal S11.

As shown in FIGS. 24 and 25 , in the present embodiment, a second planePL211 common to the MR elements 111 and 115, a second plane PL212 commonto the MR elements 112 and 116, a second plane PL213 common to the MRelements 113 and 117, and a second plane PL214 common to the MR elements114 and 118 are defined. The second plane PL211 is the same as thesecond plane PL2 (see FIGS. 3 and 4 ) corresponding to the MR element 11of the first embodiment. The second plane PL211 is thus a UY planeintersecting the first plane PL1 at a dihedral angle α.

As in the fifth embodiment, a direction rotated from the Z directiontoward the X direction by α will be referred to as a V direction. Thedirection opposite to the V direction will be referred to as a −Vdirection. The second plane PL212 is symmetrical with the second planePL211 about the YZ plane. The second plane PL212 is a plane thatintersects the first plane PL1 at a dihedral angle α and that isparallel to the V direction and Y direction, i.e., a VY plane.

The second plane PL213 is a UV plane parallel to the second plane PL211.The second plane PL214 is a VY plane parallel to the second plane PL212.

The first slope 103 b is tilted to form a dihedral angle α with respectto the first plane PL1 and is parallel to the UY plane. The second planePL211 is thus parallel to the first slope 103 b.

The second slope 103 c is tilted to form a dihedral angle α with respectto the first plane PL1 and is parallel to the VY plane. The second planePL212 is thus parallel to the second slope 103 c.

The first slope 103 d is tilted to form a dihedral angle α with respectto the first plane PL1 and is parallel to the UY plane. The second planePL213 is thus parallel to the first slope 103 d.

The second slope 103 e is tilted to form a dihedral angle α with respectto the first plane PL1 and is parallel to the VY plane. The second planePL214 is thus parallel to the second slope 103 e.

The MR elements 111 to 118 each have the same configuration as that ofthe MR element 11 of the first embodiment. More specifically, the MRelements 111 to 118 each include a first magnetic layer, a secondmagnetic layer, and a gap layer.

The magnetic field to be detected MF received by each of the MR elements111 and 115 can be divided into an in-plane component (hereinafter,referred to as a first in-plane component) parallel to the second planePL211 and a perpendicular component perpendicular to the second planePL211. The first in-plane component has a second direction that changeswith a change in the first direction D1 of the magnetic field to bedetected MF. The first magnetization of the first magnetic layer of eachof the MR elements 111 and 115 changes in direction with a change in thesecond direction of the first in-plane component. In the presentembodiment, the angle that the second direction of the first in-planecomponent forms with respect to the U direction will be referred to as asecond angle θ2. The positive and negative signs of the angle that thesecond direction of the first in-plane component forms with respect tothe U direction are defined the same as those of the second angle θ2described in the first embodiment.

The magnetic field to be detected MF received by each of the MR elements112 and 116 can be divided into an in-plane component (hereinafter,referred to as a second in-plane component) parallel to the second planePL212 and a perpendicular component perpendicular to the second planePL212. The second in-plane component has a second direction that changeswith a change in the first direction D1 of the magnetic field to bedetected MF. The first magnetization of the first magnetic layer of eachof the MR elements 112 and 116 changes in direction with a change in thesecond direction of the second in-plane component.

The angle that the second direction of the second in-plane componentforms with respect to the V direction will be referred to as a thirdangle. Within the second plane PL212, the second direction of the secondin-plane component rotates about the position where each of the MRelements 112 and 116 is located. The third angle is expressed inpositive values when seen in a direction of rotation from the Vdirection to the Y direction, and expressed in negative values when seenin a direction of rotation from the V direction to the −Y direction. Thethird angle is equal to the second angle θ2.

The magnetic field to be detected MF received by each of the MR elements113 and 117 can be divided into an in-plane component (hereinafter,referred to as a third in-plane component) parallel to the second planePL213 and a perpendicular component perpendicular to the second planePL213. The third in-plane component has a second direction that changeswith a change in the first direction D1 of the magnetic field to bedetected MF. The first magnetization of the first magnetic layer of eachof the MR elements 113 and 117 changes in direction with a change in thesecond direction of the third in-plane component.

The angle that the second direction of the third in-plane componentforms with respect to the U direction will be referred to as a fourthangle. Within the second plane PL213, the second direction of the thirdin-plane component rotates about the position where each of the MRelements 113 and 117 is located. The fourth angle is expressed inpositive values when seen in a direction of rotation from the Udirection to the Y direction, and expressed in negative values when seenin a direction of rotation from the U direction to the −Y direction. Thefourth angle is equal to the second angle θ2.

The magnetic field to be detected MF received by each of the MR elements114 and 118 can be divided into an in-plane component (hereinafter,referred to as a fourth in-plane component) parallel to the second planePL214 and a perpendicular component perpendicular to the second planePL214. The fourth in-plane component has a second direction that changeswith a change in the first direction D1 of the magnetic field to bedetected MF. The first magnetization of the first magnetic layer of eachof the MR elements 114 and 118 changes in direction with a change in thesecond direction of the fourth in-plane component.

The angle that the second direction of the fourth in-plane componentforms with respect to the V direction will be referred to as a fifthangle. Within the second plane PL214, the second direction of the fourthin-plane component rotates about the position where each of the MRelements 114 and 118 is located. The fifth angle is expressed inpositive values when seen in a direction of rotation from the Vdirection to the Y direction, and expressed in negative values when seenin a direction of rotation from the V direction to the −Y direction. Thefifth angle is equal to the second angle θ2.

The MR elements 111 to 118 each further include a second magnetic layerhaving second magnetization in a direction parallel to the respectivecorresponding second plane, and a gap layer located between the firstmagnetic layer and the second magnetic layer. In FIGS. 24, 25, and 27 ,the thick arrows indicate the directions of the second magnetization inthe second magnetic layers. In the present embodiment, the direction ofthe second magnetization in the second magnetic layer of each of the MRelements 111 and 117 is the U direction. The direction of the secondmagnetization in the second magnetic layer of each of the MR elements112 and 118 is the V direction. The direction of the secondmagnetization in the second magnetic layer of each of the MR elements113 and 115 is the −U direction. The direction of the secondmagnetization in the second magnetic layer of each of the MR elements114 and 116 is the −V direction.

In each of the MR elements 111 to 118, the direction of the firstmagnetization of the first magnetic layer changes with a change in thefirst direction D1 of the magnetic field to be detected MF. Theresistance of each of the MR elements 111 to 118 therefore changes witha change in the first direction D1. As a result, the first detectionsignal S11 changes with a change in the first direction D1.

From the viewpoint of the manufacturing accuracy of the MR elements 111to 118, the direction of the second magnetization may be slightlydifferent from the foregoing direction.

As described above, the third to fifth angles are all equal to thesecond angle θ2. The first detection signal S11 can be normalized sothat the first detection signal S11 has a value of 1 if the second angleθ2 is 0°, a value of −1 if the second angle θ2 is 180°, and a value of 0if the second angle θ2 is 90° or 270°. In this case, the first detectionsignal S11 is represented by the following Eq. (10).

S11=cos θ2.  (10)

As shown in FIG. 28 , the second magnetic detection unit 120 includesfour MR elements 121, 122, 123, and 124. As shown in FIG. 23 , the MRelements 121 to 124 are located on the main surface 103 a. In theexample shown in FIG. 23 , the MR elements 121 and 122 are arranged inthis order along the X direction, at positions on the −X direction sideof the MR element 111. In the example shown in FIG. 23 , the MR elements123 and 124 are arranged in this order along the X direction, atpositions on the −Y direction side of the MR elements 121 and 122 and onthe −X direction side of the MR element 115.

As shown in FIG. 28 , the second magnetic detection unit 120 furtherincludes two signal output nodes E21 and E22, a power supply node V12, aground node G12, and a differential detector 125. The MR element 121 isarranged between the power supply node V12 and the signal output nodeE21. The MR element 122 is arranged between the signal output node E21and the ground node G12. The MR elements 121 and 122 are connected inseries via the signal output node E21.

The MR element 123 is arranged between the power supply node V12 and thesignal output node E22. The MR element 124 is arranged between thesignal output node E22 and the ground node G12. The MR elements 123 and124 are connected in series via the signal output node E22. Apredetermined magnitude of power supply voltage is applied to the powersupply node V12. The ground node G12 is grounded. The differentialdetector 125 outputs a signal corresponding to a potential differencebetween the signal output nodes E21 and E22 as the second detectionsignal S12.

The MR elements 121 to 124 each have the same configuration as that ofthe MR element 21 of the second embodiment. More specifically, the MRelements 121 to 124 each include a third magnetic layer, a fourthmagnetic layer, and a gap layer. The third magnetic layer has thirdmagnetization that can change in direction within a virtual planeparallel to the reference plane PL3 (XY plane). The fourth magneticlayer has fourth magnetization in a direction parallel to the virtualplane. The gap layer is located between the third and fourth magneticlayers. The symbols near the MR elements 121 to 124 in FIGS. 24 and 25and the thick arrows in FIG. 28 indicate the directions of the fourthmagnetization in the respective fourth magnetic layers. In the presentembodiment, the directions of the fourth magnetization in the fourthmagnetic layers of the MR elements 121 and 124 are the Y direction. Thedirections of the fourth magnetization in the fourth magnetic layers ofthe MR elements 122 and 123 are the −Y direction.

From the viewpoint of the manufacturing accuracy of the MR elements 121to 124, the direction of the fourth magnetization may be slightlydifferent from the foregoing direction.

Like the MR element 21 of the second embodiment, the third magneticlayers of the MR elements 121 to 124 may have uniaxial magneticanisotropy in a direction parallel to the X direction. In this case, thedirections of the third magnetization of the third magnetic layerschange with the strength of the Y-direction component of the magneticfield to be detected MF, i.e., H1·sin θ1. The resistances of therespective MR elements 121 to 124 thus change with a change in H1·sinθ1. As a result, the second detection signal S12 changes with a changein H1·sin θ1. In particular, in the present embodiment, the seconddetection signal S12 is normalized to sin θ1.

A method for generating the detection value θs of the present embodimentis the same as that of the second embodiment except that the first andsecond detection signals S1 and S2 are replaced with the first andsecond detection signal S11 and S12. The configuration and function ofthe detection value generation unit 130 are the same as those of thedetection value generation unit 30 of the second embodiment except thatthe first and second detection signals S1 and S2 of the secondembodiment are replaced with the first and second detection signals S11and S12.

Next, characteristic operation and effect of the magnetic sensor 102according to the present embodiment will be described. The main surface103 a of the substrate 103 is ideally parallel to the reference planePL3 (XY plane) of the first embodiment, shown in FIGS. 3 and 4 .However, the magnetic sensor 102 can be tilted because of installationaccuracy of the magnetic sensor 102, and as a result, the main surface103 a of the substrate 103 can be tilted with respect to the referenceplane PL3. In this case, the dihedral angle α that each of the secondplanes PL211, PL212, PL213, and PL214 forms with respect to the firstplane PL1 (YZ plane) deviates from its design values.

In the present embodiment, like the MR elements 13 and 14 of the sixthembodiment, when either one of the resistances of the MR elements 111and 112 becomes greater than a desired value due to the tilt of themagnetic sensor 102, the other becomes smaller than a desired value.According to the present embodiment, the combined resistance of the MRelements 111 and 112 does not vary much because of the tilt of themagnetic sensor 102.

The foregoing description of the pair of MR elements 111 and 112 alsoapplies to the pair of MR elements 113 and 114, the pair of MR elements115 and 116, and the pair of MR elements 117 and 118. According to thepresent embodiment, the detection accuracy of the first magneticdetection unit 110 can be prevented from dropping due to the tilt of themagnetic sensor 102.

The other configuration, function and effects of the present embodimentare the same as those of the second or sixth embodiment.

The present invention is not limited to the foregoing embodiments, andvarious modifications may be made thereto. For example, the magneticsensor 102 according to the seventh embodiment may include the secondmagnetic detection unit 20 of the second or third embodiment instead ofthe second magnetic detection unit 120.

Obviously, many modifications and variations of the present inventionare possible in the light of the above teachings. Thus, it is to beunderstood that, within the scope of the appended claims and equivalentsthereof, the invention may be practiced in other embodiments than theforegoing most preferable embodiments.

What is claimed is:
 1. A magnetic sensor configured to detect a magneticfield to be detected and generate a detection value, wherein: themagnetic field to be detected has a first direction at a referenceposition within a first plane, the first direction changing within apredetermined variable range in the first plane; the magnetic sensorincludes: a substrate including a main surface and at least one slopeoblique to the main surface; and at least one magnetoresistive elementlocated on the at least one slope; the at least one magnetoresistiveelement each includes a first magnetic layer having first magnetizationthat can change in direction within a corresponding second plane; thesecond plane is oblique to each of the first plane and the main surface;the magnetic field to be detected received by each of the at least onemagnetoresistive element includes an in-plane component parallel to thesecond plane; the in-plane component has a second direction that changeswith a change in the first direction; the first magnetic layer isconfigured such that the direction of the first magnetization changeswith a change in the second direction; and the detection value dependson the direction of the first magnetization.
 2. The magnetic sensoraccording to claim 1, wherein the first magnetic layer has acharacteristic that the first magnetization is saturated by the magneticfield to be detected if the first direction is in at least a part of thepredetermined variable range.
 3. The magnetic sensor according to claim1, wherein the at least one magnetoresistive element each furtherincludes a second magnetic layer having second magnetization in adirection parallel to the second plane, and a gap layer located betweenthe first magnetic layer and the second magnetic layer.
 4. The magneticsensor according to claim 1, wherein a dihedral angle formed by thefirst plane and the second plane is in a range of 30° to 84°.
 5. Themagnetic sensor according to claim 1, wherein the second planecorresponding to each of the at least one magnetoresistive element isparallel to the at least one slope on which each of the at least onemagnetoresistive element is located.
 6. The magnetic sensor according toclaim 1, further comprising another magnetoresistive element including athird magnetic layer having third magnetization that can change indirection in a plane intersecting each of the first plane and the secondplane, wherein: the third magnetic layer is configured such that adirection of the third magnetization changes with the first direction ofthe magnetic field to be detected.
 7. The magnetic sensor according toclaim 6, wherein the third magnetic layer is configured such that thedirection of the third magnetization changes with an angle that thefirst direction of the magnetic field to be detected forms with respectto a predetermined reference direction.
 8. The magnetic sensor accordingto claim 6, wherein the another magnetoresistive element is located onthe main surface.
 9. The magnetic sensor according to claim 6, whereinthe other magnetoresistive element is located on the at least one slope.10. The magnetic sensor according to claim 1, wherein: the at least onemagnetoresistive element includes a first magnetoresistive element and asecond magnetoresistive element; and the at least one slope includes oneslope on which the first and second magnetoresistive elements arelocated.
 11. The magnetic sensor according to claim 1, wherein: the atleast one magnetoresistive element includes a first magnetoresistiveelement and a second magnetoresistive element; and the at least oneslope includes a first slope on which the first magnetoresistive elementis located and a second slope on which the second magnetoresistiveelement is located.
 12. The magnetic sensor according to claim 1,further comprising: a first magnetic detection unit that includes the atleast one magnetoresistive element and configured to generate a firstdetection signal dependent on the direction of the first magnetization;a second magnetic detection unit configured to detect the magnetic fieldto be detected and generate a second detection signal dependent on thefirst direction; and a detection value generation unit configured togenerate the detection value on a basis of the first detection signaland the second detection signal, wherein: the predetermined variablerange includes a first region and a second region that are differentfrom each other; two candidates for the first direction corresponding toa specific same value of the first detection signal fall within therespective first and second regions; and two values of the seconddetection signal corresponding to the two candidates are different fromeach other.